<template>
  <div v-if="loading" class="loading-overlay">
    <div class="loading-spinner">
      <el-icon class="is-loading"><Loading /></el-icon>
      <span class="loading-text">{{ text }}</span>
    </div>
  </div>
</template>

<script setup>
import { Loading } from '@element-plus/icons-vue'

defineProps({
  loading: {
    type: Boolean,
    default: false
  },
  text: {
    type: String,
    default: '加载中...'
  }
})
</script>

<style lang="scss" scoped>
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  
  .el-icon {
    font-size: 2rem;
    color: var(--primary-color);
  }
  
  .loading-text {
    color: var(--text-regular);
    font-size: 1rem;
  }
}
</style> 